/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2025-06-29     chenlei       the first version
 */
#include "bsp_buzzer.h"
#include "head.h"

#define DBG_TAG "bsp_buzzer"
#define DBG_LVL DBG_LOG
#include <rtdbg.h>

//蜂鸣器 LED1 LED2 位置检查引脚 初始化
void buzzer_init(void)
{
    rt_pin_mode(BUZZER_PIN, PIN_MODE_OUTPUT);
    rt_pin_mode(LED1_PIN, PIN_MODE_OUTPUT);
    rt_pin_mode(LED2_PIN, PIN_MODE_OUTPUT);
    rt_pin_mode(POSITION_PIN, PIN_MODE_INPUT_PULLUP);

    buzzer_off();
    led1_off();
    led2_on();

}


/*-----------------蜂鸣器 LED1 LED2操作函数------------*/
void buzzer_on(void)
{
    rt_pin_write(BUZZER_PIN, PIN_LOW);
}

void buzzer_off(void)
{
    rt_pin_write(BUZZER_PIN, PIN_HIGH);
}

void led1_on(void)
{
    rt_pin_write(LED1_PIN, PIN_HIGH);
}

void led1_off(void)
{
    rt_pin_write(LED1_PIN, PIN_LOW);
}

void led2_on(void)
{
    rt_pin_write(LED2_PIN, PIN_HIGH);
}

void led2_off(void)
{
    rt_pin_write(LED2_PIN, PIN_LOW);
}
/*----------------------------------------------------*/
